//  【入门1】顺序结构

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include<cmath>
#include<algorithm>
using namespace std;


int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int time = c * 60 + d - (b + a * 60);
    int hour = time / 60;
    int minu = time % 60;
    cout << hour << " " << minu << endl;

    return 0;
}




/*
int main() {
    int a;
    double b;
    cin >> a >> b;

    double c = a + b / 10;
    double trp = 1.9;
    int ans = c / trp;
    cout << ans;

    return 0;
}
*/




/*
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int grade = a * 0.2 + b * 0.3 + c * 0.5;
    cout << grade;
    return 0;
}
*/


/*
int main() {

    int h, r;
    cin >> h >> r;
    double v = (h * r * r * 3.14) / 1000;
    double drink = 20 / v;
    cout << "drink:" << drink << '\n';
    if (drink != (int)drink)
        drink += 1;
    cout << (int)drink;
    return 0;
}
*/


/*
int main() {

    int s, v;//路程和时间
    cin >> s >> v;
    int time = s / v ;
    
    int all_time = 6 * 80 - 10;
    int chufa = all_time - time;
    if (chufa >= 0) {
        int a = chufa / 60;
        int b = chufa % 60;
        if (a < 10) {
            cout << "0";
        }
        if (s % v != 0)
            b -= 1;

        cout << a << ":";
        if (b < 10) {
            cout << "0";
        }
        cout << b << '\n';
    }
    else {
        int a1 = (24 * 60 + chufa) / 60;
        int b1 = (24 * 60 + chufa) % 60;
        if (a1 < 10) {
            cout << "0";
        }
        if (s % v != 0)
            b1 -= 1;

        cout << a1 << ":";
        if (b1 < 10) {
            cout << "0";
        }
        cout << b1 << '\n';
    }
    


    return 0;
}
*/

/*
int main() {
    double a, b, c;
    cin >> a >> b >> c;
    double p = (a + b + c) / 2;
    double area = sqrt(p * (p - a) * (p - b) * (p - c));
    printf("%.1f", area);


    return 0;
}
*/

/*
int main() {
    double t;
    int n;
    cin >> t >> n;
    printf("%.3f\n", t / n);
    cout << 2 * n;

    return 0;
}
*/

/*
using namespace std;
char a, b, c, d;
int main() {
    scanf("%c%c%c.%c", &a, &b, &c, &d);
    printf("%c.%c%c%c", d, c, b, a);
    return 0;
}
*/

/*
int main() {
    char a;
    scanf("%c", &a);
    for (int i = 1; i <= 5; i += 2) {
        int temp = i;
        int trp1 = (5 - i) / 2;
        while (trp1--) printf(" ");
        while (temp--) {    
            printf("%c", a);       
        }
        int trp2 = (5 - i) / 2;
        while (trp2--) printf(" ");
        printf("\n");

    }


    return 0;
}
*/


/*
int main() {
    printf(
        "                ********\n"
        "               ************\n"
        "               ####....#.\n"
        "             #..###.....##....\n"
        "             ###.......######              ###            ###\n"
        "                ...........               #...#          #...#\n"
        "               ##*#######                 #.#.#          #.#.#\n"
        "            ####*******######             #.#.#          #.#.#\n"
        "           ...#***.****.*###....          #...#          #...#\n"
        "           ....**********##.....           ###            ###\n"
        "           ....****    *****....\n"
        "             ####        ####\n"
        "           ######        ######\n"
        "##############################################################\n"
        "#...#......#.##...#......#.##...#......#.##------------------#\n"
        "###########################################------------------#\n"
        "#..#....#....##..#....#....##..#....#....#####################\n"
        "##########################################    #----------#\n"
        "#.....#......##.....#......##.....#......#    #----------#\n"
        "##########################################    #----------#\n"
        "#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#\n"
        "##########################################    ############\n"
    );
    return 0;
}
*/

/*
int add(int a, int b) {

    return a + b;
}


int main() {
    int a;
    int b;
    scanf("%d%d", &a, &b);
    printf("%d", add(a, b));

    return 0;
}
*/

/*
int main() {
    int a[5] = { 1, 3, 5, 3, 1 };
    int max_stars = 5; // 最大星号数量，用于对齐

    for (int i = 0; i <= 4; ++i) {
        // 计算每侧需要添加的空格数
        int spaces = (max_stars - a[i]) / 2;
        // 输出左侧空格
        for (int j = 0; j < spaces; ++j) {
            printf(" ");
        }
        // 输出星号
        for (int j = 0; j < a[i]; ++j) {
            printf("*");
        }
        // 输出右侧空格
        for (int j = 0; j < spaces; ++j) {
            printf(" ");
        }
        printf("\n");
    }

    return 0;
}
*/